Package com.stytch.sdk.b2b

Stytch's B2B SDK makes it simple to seamlessly onboard, authenticate, and engage users. This SDK provides the easiest way for you to use Stytch on Android. With just a few lines of code, you can easily authenticate your users and get back to focusing on the core of your product.

Supported Authentication Products

  • magicLinks

    • Send/authenticate magic links via Email

  • sessions

    • Authenticate/refresh an existing session

    • Revoke a session (Sign out)

  • member

    • Get or fetch the current user object (sync/cached or async options available)

  • organization

    • Get or fetch the current user's organization

Using the B2B SDK

The StytchB2BClient object is your entrypoint to the Stytch B2B SDK and is how you interact with all of our supported authentication products.

Each endpoint is explained in their respective READMEs and inline-documentation, but there are a few special methods on the StytchB2BClient object to document here.

Configuration

As mentioned in the /README.md, before making any Stytch authentication requests, you must configure the StytchB2BClient:

StytchB2BClient.configure(context: Context, publicToken: String)

This configures the API for authenticating requests and the encrypted storage helper for persisting session data across app launches.

Handling Deeplinks

StytchB2BClient.handle() is the method you call for parsing out and authenticating deeplinks that your application receives. The currently supported deeplink types are: B2B Email Magic Links. This method returns a ../common/DeeplinkHandledStatus.kt class which details the result of the authentication call.

For B2B Email Magic Links, it will return a Handled class containing either the authenticated response or error.

Any other link types passed to this method will return a NotHandled class.

Types

Link copied to clipboard
typealias AuthResponse = StytchResult<IB2BAuthData>

Type alias for StytchResult used for authentication responses

Link copied to clipboard
enum B2BTokenType : Enum<B2BTokenType> , TokenType

An enum representing the supported (B2B) token types that we can extract from a deeplink

Link copied to clipboard
typealias DiscoverOrganizationsResponse = StytchResult<DiscoveredOrganizationsResponseData>

Type alias for StytchResult used for discovery.organizations() responses

Link copied to clipboard
typealias DiscoveryEMLAuthResponse = StytchResult<DiscoveryAuthenticateResponseData>

Type alias for StytchResult used for magicLinks.discovery.authenticate() responses

Link copied to clipboard
typealias EmailResetResponse = StytchResult<EmailResetResponseData>

Type alias for StytchResult used for passwords.resetByEmail() responses

Link copied to clipboard
typealias IntermediateSessionExchangeResponse = StytchResult<IntermediateSessionExchangeResponseData>

Type alias for StytchResult used for discovery.exchangeSession() responses

Link copied to clipboard
typealias MemberResponse = StytchResult<MemberResponseData>

Type alias for StytchResult used for member.get() responses

Link copied to clipboard
typealias OrganizationCreateResponse = StytchResult<OrganizationCreateResponseData>

Type alias for StytchResult used for discovery.create() responses

Link copied to clipboard
typealias OrganizationResponse = StytchResult<OrganizationResponseData>

Type alias for StytchResult used for organization.get() responses

Link copied to clipboard
typealias PasswordStrengthCheckResponse = StytchResult<StrengthCheckResponseData>

Type alias for StytchResult used for passwords.strengthCheck() responses

Link copied to clipboard
typealias SessionResetResponse = StytchResult<SessionResetResponseData>

Type alias for StytchResult used for passwords.resetBySession() responses

Link copied to clipboard
typealias SSOAuthenticateResponse = StytchResult<SSOAuthenticateResponseData>

Type alias for StytchResult used for sso.authenticate() responses

Link copied to clipboard
object StytchB2BClient

The StytchB2BClient object is your entrypoint to the Stytch B2B SDK and is how you interact with all of our supported authentication products.